Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(benchmarks): improve bechmarks to have complete performance data #326

Merged

Conversation

0xarcano
Copy link
Contributor

Description

Added the missing Sparse Merkle tree, the missing operations:

  • Added Sparse Merkle Tree to the benchmark suites to complete the available merkle tree implementations in zk-kit.

  • Added operation to the benchmark suites (proof generation, proof verification, update, delete

  • Changed the "imt.ts" name to "benchmark-merkle-trees.ts"

  • Added README.md documentation about the benchmark suite

  • Added log managment with winston library to handle any error produced during the benchmark withtout break the benchmark execution

Related Issue(s)

Closes #311

Other information

The results folder is present in gitignore then the results are not included in the pull request, but you can use the README.md instructions to generate it.

Checklist

It would be helpful to write a comparison of of all them, answering questions like

  • "when not to use"/"when to use"
  • "used by?": protocol xyz, app xyz...
  • include benchmarks: maybe one merkle tree is faster at generating a proof, but slower to update?

- Added Sparse Merkle Tree to the benchmark suites to complete the available merkle tree
implementations in zk-kit.

- Added operation to the benchmark suites (proof generation, proof verification, update, delete

- Changed the "imt.ts" name to "benchmark-merkle-trees.ts"

- Added README.md documentation about the benchmark suite

- Added log managment with winston library to handle any error produced during the benchmark
withtout break the benchmark execution

re privacy-scaling-explorations#311
@0xarcano
Copy link
Contributor Author

Dear @sripwoud, I have made the changes and run the recommended yarn commands before commit, but I have received the error:
"YN0028: The lockfile would have been modified by this install, which is explicitly forbidden."

Please give me some clues about how to solve it, I used node 20.17.0 and yarn 4.1.0, when I run yarn to install the dependencies the yarn.lock has been changed but I didn't include it to the commit because I thought that is not convenient.

…alidation issues in GH

remove package winston and to-hex libraries to fix validation issues in GH

re privacy-scaling-explorations#311
@0xarcano
Copy link
Contributor Author

Hello, I have already fixed the problems in validation of the PR.

Copy link
Member

@sripwoud sripwoud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
Small requests for changes.

it would be nice to add a summary results table to the root README (and update the conclusion if necessary based on the analysis).

Eg https://gist.github.com/sripwoud/06a1602fe8dd41c72f39c317cd1676f5#file-summary-md

benchmarks/benchmark-merkle-trees.ts Show resolved Hide resolved
benchmarks/benchmark-merkle-trees.ts Show resolved Hide resolved
benchmarks/README.md Outdated Show resolved Hide resolved
benchmarks/README.md Outdated Show resolved Hide resolved
benchmarks/benchmark-merkle-trees.ts Show resolved Hide resolved
benchmarks/benchmark-merkle-trees.ts Outdated Show resolved Hide resolved
benchmarks/benchmark-merkle-trees.ts Outdated Show resolved Hide resolved
benchmarks/README.md Outdated Show resolved Hide resolved
benchmarks/index.ts Outdated Show resolved Hide resolved
benchmarks/benchmark-merkle-trees.ts Outdated Show resolved Hide resolved
0xarcano and others added 10 commits September 16, 2024 18:58
Added benchmarks summary tables for different sizes of samples

and conclusion ideas

re # 311
…dex.ts

Added winston to package.json and refactored index.ts to

run the samples with a loop managed by an array

re privacy-scaling-explorations#311
Changed to initialize from -1 instead of 0 to fix the logic to start from the first

samples element

re privacy-scaling-explorations#311
@0xarcano
Copy link
Contributor Author

I have already took action in all the requested changes, please @sripwoud let me know how it looks

@sripwoud
Copy link
Member

@prodasl

YN0028: The lockfile would have been modified by this install, which is explicitly forbidden.

is this solved, or do you still need help with this?

Copy link
Member

@sripwoud sripwoud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nACK

One cannot install the deps with yarn or run yarn scripts (like yarn benchmarks) due to the lockfile's broken indentation.

yarn.lock Outdated Show resolved Hide resolved
benchmarks/README.md Outdated Show resolved Hide resolved
@0xarcano
Copy link
Contributor Author

@prodasl

YN0028: The lockfile would have been modified by this install, which is explicitly forbidden.

is this solved, or do you still need help with this?

@0xarcano 0xarcano closed this Sep 23, 2024
@cedoor cedoor reopened this Sep 23, 2024
@0xarcano
Copy link
Contributor Author

@prodasl

YN0028: The lockfile would have been modified by this install, which is explicitly forbidden.

is this solved, or do you still need help with this?

Hi, @sripwoud, thanks for the support.
I have some doubts about it yet, it is related to my try to send the changes on yarn.lock, because the first time I did the PR, I haven't sent the changes of yarn.lock, but this time I have a lot of change reported in the yarn lock related to packages versions, the only real change was the winston lib added, then my questions are:

Should I include the changes of yarn.lock or definitely it should not be part of the PR? (when I not included I got the mentioned problem YN0028)
If I include the yarn.lock, should I include the package version changes or just the new line for winston lib?

…n script

Change the usage instructions of benchmarks from the npx command to use the

exisiting script in the package.json

re privacy-scaling-explorations#311
…lidation

Minimal change in the code to add an space to a instruction from prettier lib suggestion
after the run the yarn command in my local environment plus

add the new dev dependency winston the yarn.lock

have changed some lib versions and added winston

re privacy-scaling-explorations#311
@0xarcano
Copy link
Contributor Author

0xarcano commented Sep 23, 2024

HI @sripwoud ,

Finally, I tried sharing the yarn.lock as it is in my local environment, sorry for all the trouble but I have not worked with those files before, all the checks in Github looks like are passed and all the change requests covered.

Please let me know if it is ready. (thanks again)

@sripwoud
Copy link
Member

@prodasl

YN0028: The lockfile would have been modified by this install, which is explicitly forbidden.

is this solved, or do you still need help with this?

Hi, @sripwoud, thanks for the support.

I have some doubts about it yet, it is related to my try to send the changes on yarn.lock, because the first time I did the PR, I haven't sent the changes of yarn.lock, but this time I have a lot of change reported in the yarn lock related to packages versions, the only real change was the winston lib added, then my questions are:

Should I include the changes of yarn.lock or definitely it should not be part of the PR? (when I not included I got the mentioned problem YN0028)

If I include the yarn.lock, should I include the package version changes or just the new line for winston lib?

TLDR: you should commit any changes to yarn.lock every time you change deps in package.json

If there are more changes in yarn.lock than strictly related to your PR it is okay and normal: it is due to yarn bumping deps automatically according to semantic versioning rules.

In practice devs exceptionally review changes in yarn.lock because there are always so huge. Reviewing package.json changes is enough.

But avoid modifying yarn.lock yourself. Stick to the yarn add/remove commands.

If it happens that there a mismatch between the committed yarn.lock and package.json then you get the error:

YN0028: The lockfile would have been modified by this install, which is explicitly forbidden.

Copy link
Member

@sripwoud sripwoud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK (successfully ran yarn benchmarks locally)

Thanks @prodasl ! Nice job.

Comment on lines +11 to +17
## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Benchmark](#benchmark)
- [Results](#results)
- [Dependencies](#dependencies)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
nice but unnecessary.
GitHub web ui automatically adds a button to see the table of contents for all .md files 😉
https://github.blog/changelog/2021-04-13-table-of-contents-support-in-markdown-files/

image

@sripwoud sripwoud added the documentation 📖 Improvements or additions to documentation label Sep 25, 2024
@sripwoud sripwoud merged commit 9adf8bf into privacy-scaling-explorations:main Sep 25, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation 📖 Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: add section to help choose merkle tree
3 participants